package com.transaction.dao;


import com.transaction.domain.Good;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface GoodDao {

    @Select("SELECT * FROM good")
    List<Good> findAllGood();

    @Select("SELECT * FROM good WHERE gid=#{gid}")
    Good findOneGood(Good good);

    @Select("SELECT * FROM good WHERE cid=#{cid}")
    List<Good> findGoodByType(Good good);

    @Insert("INSERT INTO good(gname,gprice,gtext,gsrc,cid,sid) VALUES (#{gname},#{gprice},#{gtext},#{gsrc},#{cid},#{sid})")
    Integer addOneGood(Good good);

}
